package org.lanyu.springainovel.common.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;

/**
 * Spring AI 聊天记忆实体" * 对应 spring_ai_chat_memory " */
@Schema(name = "Spring AI 对话记录")
@Data
@TableName("spring_ai_chat_memory")
public class SpringAIChatMemory {
    
    @Schema(description = "会话ID")
    @TableField("conversation_id")
    private String conversationId;
    
    @Schema(description = "消息内容")
    @TableField("content")
    private String content;
    
    @Schema(description = "消息类型：USER/ASSISTANT/SYSTEM/TOOL")
    @TableField("type")
    private String type;
    
    @Schema(description = "时间")
    @TableField("timestamp")
    private LocalDateTime timestamp;
    
    @Schema(description = "消息序号")
    @TableField("content_Index")  // 注意大小写与数据库表结构一致
    private Integer contentIndex;

    public SpringAIChatMemory() { super(); }
    
    public SpringAIChatMemory(String conversationId, String content, String type, LocalDateTime timestamp) {
        this.conversationId = conversationId;
        this.content = content;
        this.type = type;
        this.timestamp = timestamp;
    }
    
    public SpringAIChatMemory(String conversationId, String content, String type, LocalDateTime timestamp, Integer contentIndex) {
        this.conversationId = conversationId;
        this.content = content;
        this.type = type;
        this.timestamp = timestamp;
        this.contentIndex = contentIndex;
    }
}
